﻿
    using System;
    using System.Data;
    using System.IO;
    using System.Web.UI.HtmlControls;
    using Utils;

    public partial class WebPage_Index_ShuJuHuiFu : SystemBBasePage
    {
        protected bool backup = true;
        protected DataRow[] files = null;

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            this.HeaderControl1.Select = "index";
            this.Index1.Select = "Index_ShujuBeifen";
            if (base.Request["buttontype"] == "恢复")
            {
                string path = Helper.GetString(base.Request["filename"], string.Empty);
                path = base.Server.MapPath("~/backup/" + path);
                if (!((path != string.Empty) && File.Exists(path)))
                {
                    this.SetError("请选择您要恢复的数据库文件");
                }
                else
                {
                    WebSiteHelper.Restore(path);
                    base.SetSuccess("恢复成功！");
                    base.Response.Redirect("~/webpage/index-shujuhuifu.aspx");
                    base.Response.End();
                }
            }
            string str2 = Helper.GetString(base.Request["del"], string.Empty);
            if (str2 != string.Empty)
            {
                string str3 = base.Server.MapPath("~/backup/" + str2);
                if (File.Exists(str3))
                {
                    File.Delete(str3);
                    base.SetSuccess("删除备份文件:" + str2 + "成功");
                    base.Response.Redirect("~/webpage/index-shujuhuifu.aspx");
                    base.Response.End();
                    return;
                }
            }
            this.files = FileHelper.GetFilesByTime(base.Server.MapPath("~/backup"));
        }
    }



